<table class="fpTable" cellpadding="0" cellspacing="0" width="100%">
    <thead>
        <tr style="width: 25px;">
            <?php foreach ($fields as $field => $params) { ?>
                <?php
                $htmlOptions = '';
                if (!empty($params['htmlOptions'])) {
                    foreach ($params['htmlOptions'] as $v => $vv) {
                        $htmlOptions .= "'" . $v . "'=" . $vv;
                    }
                }
                ?> 

                <?php $title = !empty($params['title']) ? $params['title'] : $field; ?> 

                <th <?= $htmlOptions; ?>><?= $title; ?></th>            
            <?php } ?>
            <?php if (!empty($buttons)) { ?>    
                <th class="TAC"></th>
            <?php } ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($data as $model) { ?>
            <tr>
                <?php foreach ($fields as $field => $params) { ?>
                    <td><?= !empty($params['function']) ? $model->{ str_replace(array('(', ')'), '', trim($params['function']))}() : $model->{$field}; ?></td>
                <?php } ?>
                <?php if (!empty($buttons)) { ?>
                    <td class="TAC">
                        <?php foreach($buttons as $button) { ?>
                            <a href="<?= Yii::app()->createUrl( $button['href'], $params = array('id' => $model->id)); ?>">
                                <span class="<?= $button['icon']; ?>"></span>
                            </a>
                        <?php } ?>
                    </td>
                <?php } ?>
            </tr>     
        <?php } ?>
    </tbody>
</table>   